<script>
function formatExcelDate(numb, format = '/') {
  const time = new Date((numb - 25567) * 24 * 3600000 - 5 * 60 * 1000 - 43 * 1000 - 24 * 3600000 - 8 * 3600000)
  time.setYear(time.getFullYear())
  const year = time.getFullYear() + ''
  const month = time.getMonth() + 1 + ''
  const date = time.getDate() + ''
  if (format && format.length === 1) {
    return year + format + month + format + date
  }
  return year + (month < 10 ? '0' + month : month) + (date < 10 ? '0' + date : date)
}

// 思考如何将data中数据转化为最终输出的结果
const data = [
  {
    入职日期: 44505,
    姓名: '小张',
    工号: '9002',
    手机号: '13800000252',
    转正日期: 44892,
    部门: '总裁办'
  },
  {
    入职日期: 44506,
    姓名: '小李',
    工号: 9006,
    手机号: '13810000512',
    转正日期: 44893,
    部门: '总裁办'
  }

]

// 1. 映射对象，根据映射对象找英文的键
const mapInfo = {
  '入职日期': 'timeOfEntry',
  '手机号': 'mobile',
  '姓名': 'username',
  '转正日期': 'correctionTime',
  '工号': 'workNumber',
  '部门': 'departmentName',
  '聘用形式': 'formOfEmployment'
}

const result = data.map(item => {
  const enObj = {}
  Object.keys(item).forEach(zhkey => {
    const enkey = mapInfo[zhkey]
    enObj[enkey] = item[zhkey]
    if (enkey === 'timeOfEntry' || enkey === 'correctionTime') {
      enObj[enkey] = new Date(formatExcelDate(item[zhkey]))
    } else {
      enObj[enkey] = item[zhkey]
    }
  })
  return enObj
})
console.log(result)
</script>
